﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Web;

namespace IBMS.Common
{
    public class User
    {
        private int _id;
        private string _name;
        private string _realName;
        private string _password;
        private string _userType;
        private string _projectId;

        public User() { }

        public User(int id,string name,string realName,string password,string userType,string projectId)
        {
            _id = id;
            _name = name;
            _realName = realName;
            _password = password;
            _userType = userType;
            _projectId = projectId;
        }

        public int Id
        {
            get { return _id; }
            set { _id = value; }
        }

        public string Name
        {
            get { return _name; }
            set { _name = value; }
        }

        public string RealName
        {
            get { return _realName; }
            set { _realName = value; }
        }

        public string Password
        {
            get { return _password; }
            set { _password = value; }
        }

        public string UserType
        {
            get { return _userType; }
            set { _userType = value; }
        }

        public string ProjectId
        {
            get { return _projectId; }
            set { _projectId = value; }
        }

        public string MD5(string encryptString)
        {
            byte[] result = Encoding.Default.GetBytes(encryptString);
            MD5 md5 = new MD5CryptoServiceProvider();
            byte[] output = md5.ComputeHash(result);
            string encryptResult = BitConverter.ToString(output).Replace("-", "");
            return encryptResult;
        }
    }
}